local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script,script.Parent.base,script.Parent.Name);

local Function_manager =_G.ServerOHOH.function_manager();
local function_list =  _G.ServerOHOH.function_list;

function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent);
end;

--进入一场战斗（子类复写）
function M.EnterBattle(self)
	 --寻找目标检测
	self:OpenFindAttackTargetCheck()
	--开启攻击力检测
	self:OpenAttackDamgeCheck()
end

--离开一场战斗（子类复写）
function M.OutBattle(self)
	--关闭目标检测
	self:CloseFindAttackTargetCheck()
	--关闭攻击力检测
	self:CloseAttackDamgeCheck()
end

--服务器收到消息，退出战斗，待完成.....
function M.ExitBattle(self)
    if self.Battle then
		self:AddProcess(function()
			self.Battle:Exit(self.parent)
		end)
		
		return true
    end
	return false
end

local EventList = CommonOHOH.load.EventList();

--一场战斗胜利了
function M.Victory(self)
	self.parent:Fire(EventList.battle_victory)

end


function M.dtor(self)
	M.super.dtor(self);
end

Function_manager:SetHandle(function_list.ExitBattle, function(player)
	local attackCtrl = player:GetComponent(CommonOHOH.load.Common_AttackCtrl());
	--print("--------收到客户端退出战斗消息-------->",attackCtrl)
	return  attackCtrl:ExitBattle()
end)






return M